package com.gitee.dbswitch.admin.type;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

@Getter
@AllArgsConstructor
public enum ConfigTypeEnum {
    ASSIGNMENT_CONFIG(0, "db同步"),
    API_ASSIGNMENT_CONFIG(1, "api同步"),
    ;

    private final Integer value;
    private final String description;

    public static LogTypeEnum of(Integer v) {
        if (!Objects.isNull(v)) {
            for (LogTypeEnum type : LogTypeEnum.values()) {
                if (v == type.getValue()) {
                    return type;
                }
            }
        }

        throw new IllegalArgumentException("no such value: " + v);
    }
}
